package com.orange.core.pojo.rsp.activity;

import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * <p>ClassName:ActivityOrderPayRsp</p>
 * <p>Description: 活动支付</p>
 * <p>Author: lwm</p>
 * <p>Date: 2025/7/13 10:58</p>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ActivityOrderPayRsp implements Serializable {

    private static final long serialVersionUID = -3937440847663866264L;

    /**
     * 微信支付appId
     */
    private String appId;

    /**
     * 时间戳
     */
    private String timeStamp;

    /**
     * 随机字符串
     */
    private String nonceStr;

    /**
     * 预支付交易会话标识
     */
    private String packageValue;

    /**
     * 签名类型
     */
    private String signType;

    /**
     * 签名
     */
    private String paySign;

    /**
     * 是否成功
     */
    private Boolean success;

    /**
     * 错误信息
     */
    private String errorMessage;

    /**
     * 活动订单号
     */
    private Integer orderId;

    /**
     * 创建成功响应
     * @return
     */
    public static ActivityOrderPayRsp success(){
        ActivityOrderPayRsp response = new ActivityOrderPayRsp();
        response.setSuccess(true);
        return response;
    }

    /**
     * 创建失败响应
     * @return
     */
    public static ActivityOrderPayRsp fail() {
        ActivityOrderPayRsp response = new ActivityOrderPayRsp();
        response.setSuccess(false);
        response.setErrorMessage("支付失败");
        return response;
    }

    /**
     * 创建失败响应，带自定义错误信息
     * @param errorMessage 自定义错误信息
     * @return 失败响应对象
     */
    public static ActivityOrderPayRsp fail(String errorMessage) {
        ActivityOrderPayRsp response = new ActivityOrderPayRsp();
        response.setSuccess(false);
        response.setErrorMessage(errorMessage);
        return response;
    }
}
